[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
textheight() Get a String's Height in Pixels
#include <graphics.h>
int far textheight(tstring);
char far *tstring;
textheight() gets the height of 'tstring' in pixels by using the
current text font size and multiplication factor. textheight() and
textwidth() are used for sizing strings that need to be fit into
existing spaces.
Returns: The text height in pixels.
-------------------------------- Example ---------------------------------
The following statements size the word "squeeze" and print it in a
small box.
#include <graphics.h>
#include <conio.h>
main()
{
int gdriver = DETECT;
int gmode;
char *txt = "Squeeze";
initgraph(&gdriver,&gmode,"");
settextjustify(CENTER_TEXT,CENTER_TEXT);
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,USER_CHAR_SIZE);
setusercharsize(60,textwidth(txt),50,textheight(txt));
settextstyle(SANS_SERIF_FONT,HORIZ_DIR,USER_CHAR_SIZE);
rectangle(290,125,350,175);
outtextxy(320,150,txt);
getch();
closegraph();
}
See Also:
gettextsettings()
outtext()
textwidth()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson